//引入vue-router
import VueRouter from "vue-router"
//引入组件
import Home from "@/views/home/index.vue";
import Teacher from "@/views/teacher/index.vue";
import Class from "@/views/class/index.vue";
import Grade from "@/views/grade/index.vue";
import Student from "@/views/student/index.vue";
import Admin from "@/views/admin/index.vue";
import Personal from "@/views/personal/index.vue";
import Index from "@/views/index/index.vue";
import login from "@/components/Login.vue"
import notFindPage  from "@/components/404.vue"
import vxeTableStudent from "@/views/vxetableStudent/index.vue"
import Count from "@/views/count/index.vue";

//路由规则
const routes = [
    // 重定向到一级路由Home
    {
        path: '/',
        redirect: '/login'
    },
    //登录页面
    {
        name: "login",
        path: '/login',
        component: login,
    },
    //404页面
    {
        name: "404",
        path: '/notFindPage',
        component: notFindPage,
    },
    //配置路由的路径
    {
        //Home是一级路由
        name: 'home',
        path: '/home',
        component: Home,
        //一级路由的孩子们（二级路由）
        children: [
            {
                name: 'index',
                path: 'index',
                component: Index,
            },
            {
                name: 'student',
                path: 'student',
                component: Student,
            },
            {
                name: 'teacher',
                path: 'teacher',
                component: Teacher,
            },
            {
                name: 'class',
                path: 'class',
                component: Class,
            },
            {
                name: 'grade',
                path: 'grade',
                component: Grade,
            },
            {
                name: 'admin',
                path: 'admin',
                component: Admin,
            },
            {
                name: 'personal',
                path: 'personal',
                component: Personal,
            },
            {
                name: 'vxeTableStudent',
                path: 'vxeTableStudent',
                component: vxeTableStudent,
            },
            {
                name: 'count',
                path: 'count',
                component: Count,
            },

        ]

    },
]
//创建路由对象
const router = new VueRouter({
    mode: 'hash',// 模式:1、history模式，去除url里的“#” （会存在刷新找不到文件的情况） 2、hash模式
    routes
})


//对外暴露路由
export default router
